home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / SourceCode / AdobeExamples / NX_HitDetect / HitPointView.m < prev    next >
Encoding:
Text File  |  1992-12-19  |  2.2 KB  |  80 lines

  1.  
  2. /*
  3.  * (a)  (C) 1990 by Adobe Systems Incorporated. All rights reserved.
  4.  *
  5.  * (b)  If this Sample Code is distributed as part of the Display PostScript
  6.  *    System Software Development Kit from Adobe Systems Incorporated,
  7.  *    then this copy is designated as Development Software and its use is
  8.  *    subject to the terms of the License Agreement attached to such Kit.
  9.  *
  10.  * (c)  If this Sample Code is distributed independently, then the following
  11.  *    terms apply:
  12.  *
  13.  * (d)  This file may be freely copied and redistributed as long as:
  14.  *    1) Parts (a), (d), (e) and (f) continue to be included in the file,
  15.  *    2) If the file has been modified in any way, a notice of such
  16.  *      modification is conspicuously indicated.
  17.  *
  18.  * (e)  PostScript, Display PostScript, and Adobe are registered trademarks of
  19.  *    Adobe Systems Incorporated.
  20.  * 
  21.  * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
  22.  *    CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
  23.  *    AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
  24.  *    ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
  25.  *    OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
  26.  *    WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
  27.  *    WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
  28.  *    DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, 
  29.  *    FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
  30.  *    OF THIRD PARTY RIGHTS.
  31.  */
  32.  
  33. /*
  34.  *    HitPointView.m
  35.  *
  36.  *    This class is used to draw the hit sensitivity rectangle in the drawing
  37.  *    options window.
  38.  *
  39.  *    Version:    2.0
  40.  *    Author:    Ken Fromm
  41.  *    History:
  42.  *            03-07-91        Added this comment.
  43.  */
  44.  
  45. #import "HitPointView.h"
  46. #import "DetectApp.h"
  47.  
  48. #import <appkit/View.h>
  49. #import <appkit/Control.h>
  50. #import <dpsclient/wraps.h>
  51.  
  52. @implementation HitPointView
  53.  
  54. - drawHitSetting:sender
  55. {    
  56.     [NXApp  setHitSetting:(float) [sender  selectedTag]];
  57.  
  58.     [self display];
  59.     
  60.     return self;    
  61. }
  62.  
  63. /* Clear the view and then draw the correctly-sized hit point in the center of the view. */
  64. -drawSelf:(NXRect *)r :(int) count
  65. {
  66.     float        hitSetting;
  67.  
  68.     hitSetting = [NXApp hitSetting];
  69.  
  70.     PSsetgray(NX_LTGRAY);
  71.     PSrectfill(0.0, 0.0, bounds.size.width, bounds.size.height);
  72.     PSsetgray(NX_DKGRAY);
  73.     PSrectfill((bounds.size.width - hitSetting)/2, (bounds.size.height - hitSetting)/2,
  74.               hitSetting, hitSetting);
  75.     
  76.     return self;            
  77. }
  78.  
  79. @end
  80.